﻿using System;

namespace 账号管理
{
    /// <summary>
    /// 数据库访问工厂
    /// </summary>
    public class DatabaseFactory
    {
        /// <summary>
        /// 创建数据库连接
        /// </summary>
        /// <param name="connectionStringName">数据库连接配置名称</param>
        /// <returns></returns>
        public static IDatabase CreateDatabase(string connectionStringName = "*")
        {
            return new XConnection(connectionStringName);
        }
        /// <summary>
        /// 创建数据库连接
        /// </summary>
        /// <param name="connectionString">数据库链接字符串</param>
        /// <param name="providerName">数据库连接类型名称</param>
        /// <returns></returns>
        public static IDatabase CreateDatabase(string connectionString, string providerName = "System.Data.SqlClient")
        {
            return new XConnection(connectionString, providerName);
        }
    }
}
